<!--
 * @Author: zhangxiangsheng 1026583651@qq.com
 * @Date: 2024-06-17 15:04:34
 * @LastEditors: zhangxiangsheng 1026583651@qq.com
 * @LastEditTime: 2024-06-19 09:32:37
 * @FilePath: \appGly\components\formz\components\pt.vue
 * @Description: 
 * 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
-->
<template>
  <view class="">
    <u-form-item
      :label="item.label"
      :prop="item.value"
      borderBottom
      ref="item1"
    >
      <u-button
        :text="value || $z.$t('请选择')"
        :hairline="false"
        :customStyle="btnstyle"
        @click="btntap"
      ></u-button>
    </u-form-item>
    <ptpopup ref="ptpopup" @save="save"></ptpopup>
  </view>
</template>

<script>
  import ptpopup from "./ptpopup.vue";
  export default {
    components: {
      ptpopup,
    },
    props: {
      item: {
        typeof: Object,
        default: () => {
          return {};
        },
      },
      data: {
        typeof: Object,
        default: () => {
          return {};
        },
      },
      value: {
        typeof: [String, Number, Boolean, Array, Object],
        default: () => {
          return "";
        },
      },
    },
    data() {
      return {
        show: false,
        showtext: "",
        btnstyle: {
          border: "none",
          padding: "0",
          justifyContent: "flex-start",
        },
      };
    },
    // watch: {
    //   value: {
    //     async handler() {
    //       if (this.value == "") {
    //       }
    //     },
    //     immediate: true,
    //   },
    // },
    computed: {
      mapOverlays() {
        return {
          show: this.show,
          value: this.value,
        };
      },
    },
    methods: {
      popupback() {
        this.show = false;
      },
      btntap(item) {
        this.$refs.ptpopup.show(this.value);
      },
      save(str) {
        this.$emit("input", str);
      },
    },
  };
</script>

<style lang="scss">
  .popupcontent {
    height: 100vh;
    display: flex;
    flex-direction: column;

    #amap {
      flex: 1;
      height: 0;
    }
  }
</style>
